package com.modifiertech.lineage.event;

import com.modifiertech.lineage.BaseConst;
import com.modifiertech.lineage.api.PlayerDataSkill;
import com.modifiertech.lineage.skills.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.libraries.ModList;
import net.minecraftforge.registries.RegistryBuilder;

import java.util.ArrayList;
import java.util.List;

@Mod.EventBusSubscriber(modid = BaseConst.MODID)
public class LineageRegistryHandler {
    @SubscribeEvent
    public static void buildRegistry(RegistryEvent.NewRegistry newRegistryEvent) {
        new RegistryBuilder<PlayerDataSkill>().setName(new ResourceLocation(BaseConst.MODID, "skill")).setType(PlayerDataSkill.class).create();
    }

    /**注册技能
     *
     * @param skillRegister
     */
    @SubscribeEvent
    public static void registerSkills(RegistryEvent.Register<PlayerDataSkill> skillRegister) {
        List<PlayerDataSkill> playerDataSkillList = new ArrayList<>();
        playerDataSkillList.add(new BlackMagic());
        playerDataSkillList.add(new StrongAsBull());
        playerDataSkillList.add(new JumpSplash());
        playerDataSkillList.add(new RangeHealth());
        //ext:维克的现代战争
        if (Loader.isModLoaded("mw")) playerDataSkillList.add(new ShooterDiscipline());
        skillRegister.getRegistry().registerAll(playerDataSkillList.toArray(new PlayerDataSkill[]{}));
    }
    //注册增益
    //注册减益
    //注册职业
    //注册头衔
}
